home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-25 | 1.3 KB | 34 lines | [TEXT/3PRM] |
- module HelloWorld
-
- /* Hello World!
- */
-
- import deltaEventIO, deltaWindow, deltaPicture
-
- DontCareId :== 0
-
- Start :: *World -> *World
- Start world
- # (events,world) = OpenEvents world // fetch the event stream from the world
- (_,events) = StartIO ioSystem initProgramState [] events // perform our IO function on the event stream
- world = CloseEvents events world // close the event stream
- = world
- where
- ioSystem // this program uses only a window
- = [WindowSystem [window]]
- window
- = FixedWindow DontCareId (10,10) "Greeting" ((0,0),(162,100)) updateFunction
- [ Keyboard Able quitFunction // pressing any key quits the program
- , Mouse Able quitFunction // pressing the mouse quits the program
- , GoAway quit // closing the window quits the program
- ]
- quitFunction _ programState io // ignore the first argument of mouse or keyboard information
- = quit programState io
- quit programState io // bye, bye: causes StartIO to terminate
- = (programState, QuitIO io)
- updateFunction _ programState // display the contens of the window
- = (programState, [MovePenTo (30,30), DrawString "Hello World!"])
-
- initProgramState // arbitrary because this program doesn't use the program state
- = 0
-